<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<meta http-equiv="X-UA-Compatible" content="IE=edge">
		<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
		<title>推广设定</title>
		<link rel="stylesheet" type="text/css" href="__STATIC__/home/css/reset.css"/>
		<link rel="stylesheet" type="text/css" href="__STATIC__/home/css/tuiguangsheding.css"/>
	</head>
	<body>
		<div class="wrapper">
			<div class="top">
		 	 	<p class="top-p1" onclick="javascript:history.back(-1);"> < </p>
		 	 	<p class="top-p2">推广设定</p>
		 	</div>
		 	<div class="content">
		 		<div class="content1">
		 			 <a href="#" class="content11">代理</a>
		 			 <a href="{:url('user/adduser')}" class="content12">会员</a>
		 		</div>
		 		<p class="content2">请设置返点</p>
		 		<div class="content3">
		 			<img src="__STATIC__/home/images/2.jpg" class="content31"/>
		 			<input type="text" class="content32" placeholder="返点为0-{$rebate}(%)" id="content32"/>
		 		</div>
		 		<div class="content4">
		 			生成链接
		 		</div>
		 		<div class="content5">
		 			<div class="content51">
		 				<p class="content511">链接：</p>
		 				<p class="content512" style="width:90%;">http://www.iconfont.cn/search/i...</p>
		 				<div class="content513">复制链接</div>
		 			</div>
		 		</div>
		 	</div>
		</div>
	</body>
</html>
<script src="__STATIC__/home/js/zepto.min.js" type="text/javascript" charset="utf-8"></script>
<script src="__STATIC__/home/js/base.js" type="text/javascript" charset="utf-8"></script>
<script type="text/javascript">
	//弹出生成链接框
	//当返点为0~0.1时，出现弹框，否则alert，
	$('.content4').tap(function(){
		var fandian = $('.content32').val();
		 if(!fandian){
		 	alert('请输入返点');
		 }else if(fandian >= 0 && fandian <= {$rebate} ){
		     var rebate = $('#content32').val();
             $.ajax({
                 url: "{:url('link/makelink')}",
                 type: 'post',
                 data: {
                     rebate:rebate,
                 },
                 success:function(data) {
                     var status = JSON.parse(data);
                     console.log(status)
                     if(status.msg == 1) {
                         $('.content512').html(status.link)
                         $('.content5').css("display",'block');
                     }else {
                         alert(status.info,1000)
                     }
                 }
             })
		 }else{
		 	alert('请输入正确的返点');
		 };
	});
	
	//生成链接框消失
	$('.content5').tap(function(){
		$('.content5').css("display",'none');
	});
	//复制链接 没写
</script>